import request from '@/utils/request';
import type { AxiosPromise } from '@/utils/request';
import type { GeneralApprovalVO, GeneralApprovalForm, GeneralApprovalQuery } from '@/pagesA/api/workflow/generalApproval/types';

/**
 * 查询通用审批列表
 * @param query
 * @returns {*}
 */

export const listGeneralApproval = (query?: GeneralApprovalQuery): AxiosPromise<GeneralApprovalVO[]> => {
  return request({
    url: '/workflow/generalApproval/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询通用审批详细
 * @param id
 */
export const getGeneralApproval = (id: string | number): AxiosPromise<GeneralApprovalVO> => {
  return request({
    url: '/workflow/generalApproval/' + id,
    method: 'get'
  });
};

/**
 * 新增通用审批
 * @param data
 */
export const addGeneralApproval = (data: GeneralApprovalForm) => {
  return request({
    url: '/workflow/generalApproval',
    method: 'post',
    data: data
  });
};

/**
 * 修改通用审批
 * @param data
 */
export const updateGeneralApproval = (data: GeneralApprovalForm) => {
  return request({
    url: '/workflow/generalApproval',
    method: 'put',
    data: data
  });
};

/**
 * 删除通用审批
 * @param id
 */
export const delGeneralApproval = (id: string | number | Array<string | number>) => {
  return request({
    url: '/workflow/generalApproval/' + id,
    method: 'delete'
  });
};
